# -*- coding: utf-8 -*-

from static.extension import db


class Admin(db.Model):
    __tablename__ = 'admin'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    admin = db.Column(db.String(255), nullable=False)
    password = db.Column(db.String(255), nullable=False)

    @staticmethod
    def init_db():
        rets = [
            (1, '001', 'xsdqwew'),
            (2, '002', 'xagrgrgre')
        ]
        for ret in rets:
            admin = Admin()
            admin.id = ret[0]
            admin.admin = ret[1]
            admin.password = ret[2]
            db.session.add(admin)
        db.session.commit()
